home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_nub_h2oswitch2.cog < prev    next >
Text File  |  1999-11-15  |  23KB  |  886 lines

  1. # Jones 3D Cog Script
  2. #
  3. # nub_h2oswitch.cog
  4. #
  5. # [TL] [GGJ]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. #
  9. # ========================================================================================
  10. symbols
  11.  
  12. message    startup
  13. message    arrived
  14. message    activated
  15. message    entered
  16. message    timer
  17.  
  18. thing    target        local
  19. int        originIndex    local
  20.  
  21. thing    origin0
  22. thing    origin1
  23. thing    origin2
  24. thing    origin3
  25.  
  26. thing    targetArray00
  27. thing    targetArray01
  28. thing    targetArray02
  29.  
  30. thing    targetArray10
  31. thing    targetArray11
  32. thing    targetArray12
  33.  
  34. thing    targetArray20
  35. thing    targetArray21
  36. thing    targetArray22
  37.  
  38. thing    targetArray30
  39. thing    targetArray31
  40. thing    targetArray32
  41.  
  42. material    lightningmat0=aet_4sfx_lightning_v2_a.mat    local    # Mats for the lightning.
  43. material    lightningmat1=aet_4sfx_lightning_v2_b.mat    local
  44. material    lightningmat2=aet_4sfx_lightning_v2_c.mat    local
  45. material    lightningmat3=aet_4sfx_lightning_v2_d.mat    local
  46. material    lightningmat4=aet_4sfx_lightning_v2_e.mat    local
  47.  
  48. sound        strike0=aet_lightning_01.wav                local
  49. sound        strike1=aet_lightning_02.wav                local
  50. sound        strike2=aet_lightning_03.wav                local
  51. sound        strike3=aet_lightning_04.wav                local
  52.  
  53. thing    player        local
  54. thing    switchA        # Controls paddle0top and paddle0bottom
  55. thing    switchB        # Controls paddle1top and paddle1bottom
  56. thing    h2o            # Water surface 3do.
  57. thing    camera0        # Camera for pool.
  58. thing    camera1
  59. thing    paddleAtop          linkID=2
  60. thing    paddleAbottom    linkID=2
  61. thing    paddleBtop          linkID=2
  62. thing    paddleBbottom    linkID=2
  63. thing    paddleTarget
  64.  
  65. sector    twater0        linkID=1    # Top water sectors.
  66. sector    twater1        linkID=1
  67. sector    twater2        linkID=1
  68. sector    twater3        linkID=1
  69. sector    twater4        linkID=1
  70. sector    twater5        linkID=1
  71. sector    twater6        linkID=1
  72. sector    twater7        linkID=1
  73.  
  74. sector    trigger
  75.  
  76. sector    bwater0        # Bottom water sectors.
  77. sector    bwater1
  78. sector    bwater2
  79. sector    bwater3
  80. #sector    bwater4
  81.  
  82. sector    ptsec0
  83. sector    ptsec1
  84. sector    ptsec2
  85.  
  86. sector    pbsec0
  87. sector    pbsec1
  88. sector    pbsec2
  89.  
  90. surface    surface0a    # Top water surface adjoins.
  91. surface    surface0b
  92. surface    surface0c
  93. surface    surface0d
  94. surface    surface0e
  95. surface    surface0f
  96. surface    surface0g
  97. surface    surface0h
  98. surface    surface0i
  99.  
  100. surface    surface1a    # Middle water surface adjoins.
  101. surface    surface1b
  102. surface    surface1c
  103. surface    surface1d
  104. surface    surface1e
  105. surface    surface1f
  106. surface    surface1g
  107. surface    surface1h
  108.  
  109. surface    electroSurf0
  110. surface    electroSurf1
  111. surface    electroSurf2
  112. surface    electroSurf3
  113. surface    electroSurf4
  114. surface    electroSurf5
  115. surface    electroSurf6
  116. surface    electroSurf7
  117.  
  118. int        elecTrac0        local
  119. int        elecTrac1        local
  120. int        elecTrac2        local
  121. int        elecTrac3        local
  122. int        elecTrac4        local
  123. int        elecTrac5        local
  124. int        elecTrac6        local
  125. int        elecTrac7        local
  126.  
  127.  
  128. int        full=0        local    #
  129. int        curcam        local    # Duh.
  130. int        firstPushA=0    local
  131. int        firstPushB=0    local
  132. int        toggle=0        local
  133. int        cnt                local
  134. int        randnum            local
  135. int        topHoleA        local
  136. int        topHoleB        local
  137. int        bottomHoleA        local
  138. int        bottomHoleB        local
  139. int        open=1            local
  140. int        closed=0        local
  141. int        lightning=0        local
  142. int        firstEnter=0    local
  143. int        solved=0        local
  144. sector    currentSector    local
  145. vector    veclight        local
  146. vector    nolight            local
  147. vector    lesslight        local
  148.  
  149. flex    countdown            # Speed of water draining or filling.
  150. flex    paddlecheck        local
  151.                             
  152. cog        lightningcog        # Cog which controls the lightning strikes.
  153.  
  154. end
  155.  
  156. # ========================================================================================
  157. code
  158.  
  159. startup:
  160. player = GetLocalPlayerThing();
  161. full=1;
  162.  
  163. # Light up paddles
  164. SetThingLight(paddleAtop, VectorSet(1.0, 1.0, 1.0), 0.01, 1.0);
  165. SetThingLight(paddleAbottom, VectorSet(1.0, 1.0, 1.0), 0.01, 1.0);
  166. SetThingLight(paddleBtop, VectorSet(1.0, 1.0, 1.0), 0.01, 1.0);
  167. SetThingLight(paddleBbottom, VectorSet(1.0, 1.0, 1.0), 0.01, 1.0);
  168.  
  169. # Turn off the moving water 3do.
  170. SetThingFlags(h2o, 0x80000);
  171. SetCollideType(h2o, 0);
  172.  
  173. # Turn off middle level water adjoins.
  174. SetFaceGeoMode(surface1a, 0);
  175. SetFaceGeoMode(surface1b, 0);
  176. SetFaceGeoMode(surface1c, 0);
  177. SetFaceGeoMode(surface1d, 0);
  178. SetFaceGeoMode(surface1e, 0);
  179. SetFaceGeoMode(surface1f, 0);
  180. SetFaceGeoMode(surface1g, 0);
  181. SetFaceGeoMode(surface1h, 0);
  182. # ...make bottom water light...
  183. SetSectorLight(bwater0, veclight, 2);
  184. SetSectorLight(bwater1, veclight, 2);
  185. SetSectorLight(bwater2, veclight, 2);
  186. SetSectorLight(bwater3, veclight, 2);
  187. #SetSectorLight(bwater4, veclight, 2);
  188.  
  189. # ...make bottom paddle sectors light...
  190. SetSectorlight(pbsec0, veclight, 2);
  191. SetSectorlight(pbsec1, veclight, 2);
  192. SetSectorlight(pbsec2, lesslight, 2);
  193.  
  194. # ...make top water light...
  195. SetSectorLight(twater0, veclight, 2);
  196. SetSectorLight(twater1, veclight, 2);
  197. SetSectorLight(twater2, veclight, 2);
  198. SetSectorLight(twater3, veclight, 2);
  199. SetSectorLight(twater4, veclight, 2);
  200. SetSectorLight(twater5, veclight, 2);
  201. SetSectorLight(twater6, veclight, 2);
  202. SetSectorLight(twater7, veclight, 2);
  203.  
  204. # ...make top paddle sectors light...
  205. SetSectorlight(ptsec0, veclight, 2);
  206. SetSectorlight(ptsec1, veclight, 2);
  207. SetSectorlight(ptsec2, lesslight, 2);
  208.  
  209. topHoleA=closed;
  210. topHoleB=closed;
  211. bottomHoleA=closed;
  212. bottomHoleB=closed;
  213.  
  214. veclight = VectorSet(0, 0.2, 0.8);
  215. nolight = VectorSet(0, 0, 0);
  216. lesslight = VectorSet(0, 0.1, 0.5);
  217.  
  218. return;
  219.  
  220. # ........................................................................................
  221. activated:
  222. # At startup, all 4 paddles are closed.
  223.  
  224. # First push of SwitchA opens paddleAtop.
  225. if ((GetSenderRef() == switchA) && (firstPushA == 0))
  226. {
  227.     firstPushA = 1;
  228.     StartCutscene(1);
  229.     SetActorFlags(player, 0x200000);
  230.     StopThing(player);
  231.     MakeMeStop();
  232.     ResetThing(player);
  233.     SetCameraFocus(2, camera1);
  234.     SetCameraSecondaryFocus(2, paddletarget);
  235.     SetCurrentCamera(2);
  236.     SetCameraFOV(120, 0, 0.0);
  237.     MoveToFrame(camera1, 1, 0.25);
  238.     MoveToFrame(paddletarget, 1, 0.25);
  239.     
  240.     MoveToFrame(paddleAtop, 1 - (GetCurFrame(paddleAtop)), 0.5);
  241.     
  242.     TopHoleA=open;
  243.     Print("top paddle A is open");
  244.     call paddlecheck;
  245.  
  246.     Sleep(4.0);
  247.  
  248.  
  249.     # ...return camera to player...
  250.     SetCameraFocus(2, camera0);
  251.     SetCameraSecondaryFocus(2, h2o);
  252.     SetCurrentCamera(2);
  253.     SetCameraFOV(90, 1, 5.0);
  254.     Sleep(5.0);
  255.  
  256.     SetCurrentCamera(1);
  257.     ClearActorFlags(player, 0x200000);
  258.     EndCutscene();
  259.     MoveToFrame(camera1, 0, 10.0);
  260.     MoveToFrame(paddletarget, 0, 10.0);
  261.     
  262.     return;
  263. }
  264.  
  265. # Second push of SwitchA closes paddleAtop and opens paddleAbottom.
  266. # Subsequent pushes toggle the paddles.
  267. if ((GetSenderRef() == switchA) && (firstPushA == 1))
  268. {
  269.     StartCutscene(1);
  270.     SetActorFlags(player, 0x200000);
  271.     StopThing(player);
  272.     MakeMeStop();
  273.     ResetThing(player);
  274.     SetCameraFocus(2, camera1);
  275.     SetCameraSecondaryFocus(2, paddletarget);
  276.     SetCurrentCamera(2);
  277.     SetCameraFOV(120, 0, 0.0);
  278.     MoveToFrame(camera1, 1, 0.25);
  279.     MoveToFrame(paddletarget, 1, 0.25);
  280.     MoveToFrame(paddleAtop, 1 - (GetCurFrame(paddleAtop)), 0.5);
  281.     MoveToFrame(paddleAbottom, 1 - (GetCurFrame(paddleAbottom)), 0.5);
  282.  
  283.     
  284.     if (TopHoleA == open)
  285.     {
  286.         Print("top paddle A is closed");
  287.         Print("bottom paddle A is open");
  288.         
  289.         TopHoleA = closed;
  290.         BottomHoleA = open;
  291.     }
  292.     else
  293.     {
  294.         Print("top paddle A is open");
  295.         Print("bottom paddle A is closed");
  296.         
  297.         TopHoleA = open;
  298.         BottomHoleA = closed;
  299.     }
  300.     call paddlecheck;
  301.  
  302.     Sleep(4.0);
  303.     
  304.     SetCameraFocus(2, camera0);
  305.     SetCameraSecondaryFocus(2, h2o);
  306.     SetCurrentCamera(2);
  307.     SetCameraFOV(90, 1, 5.0);
  308.     Sleep(5.0);
  309.  
  310.     
  311.     # ...return camera to player...
  312.     SetCurrentCamera(1);
  313.     ClearActorFlags(player, 0x200000);
  314.     EndCutscene();
  315.     MoveToFrame(camera1, 0, 10.0);
  316.     MoveToFrame(paddletarget, 0, 10.0);
  317.     
  318.     return;
  319. }
  320.  
  321. # First push of SwitchB opens paddleBbottom.
  322. if ((GetSenderRef() == switchB) && (firstPushB == 0))
  323. {
  324.     firstPushB = 1;
  325.     
  326.     StartCutscene(1);
  327.     SetActorFlags(player, 0x200000);
  328.     StopThing(player);             
  329.     MakeMeStop();
  330.     ResetThing(player);
  331.     
  332.     SetCameraFocus(2, camera1);
  333.     SetCameraSecondaryFocus(2, paddletarget);
  334.     SetCurrentCamera(2);
  335.     SetCameraFOV(120, 0, 0.0);
  336.     MoveToFrame(camera1, 1, 0.25);
  337.     MoveToFrame(paddletarget, 1, 0.25);
  338.     MoveToFrame(paddleBbottom, 1 - (GetCurFrame(paddleBbottom)), 0.5);
  339.  
  340.     
  341.     bottomHoleB = open;
  342.     Print("bottom paddle B is open");
  343.     call paddlecheck;
  344.     
  345.     
  346.     Sleep(4.0);
  347.     
  348.     SetCameraFocus(2, camera0);
  349.     SetCameraSecondaryFocus(2, h2o);
  350.     SetCurrentCamera(2);
  351.     SetCameraFOV(90, 1, 5.0);
  352.     Sleep(5.0);
  353.  
  354.     
  355.     # ...return camera to player...
  356.     SetCurrentCamera(1);
  357.     ClearActorFlags(player, 0x200000);
  358.     EndCutscene();
  359.     MoveToFrame(camera1, 0, 10.0);
  360.     MoveToFrame(paddletarget, 0, 10.0);
  361.     
  362.     return;
  363. }
  364. # Second push of SwitchB closes paddleBbottom and opens paddleBtop.
  365. # Subsequent pushes toggle the paddles.
  366. if ((GetSenderRef() == switchB) && (firstPushB == 1))
  367. {
  368.     StartCutscene(1);
  369.     SetActorFlags(player, 0x200000);
  370.     StopThing(player);
  371.     MakeMeStop();
  372.     ResetThing(player);
  373.                        
  374.     SetCameraFocus(2, camera1);
  375.     SetCameraSecondaryFocus(2, paddletarget);
  376.     SetCurrentCamera(2);
  377.     SetCameraFOV(120, 0, 0.0);
  378.     MoveToFrame(camera1, 1, 0.25);
  379.     MoveToFrame(paddletarget, 1, 0.25);
  380.     MoveToFrame(paddleBtop, 1 - (GetCurFrame(paddleBtop)), 0.5);
  381.     MoveToFrame(paddleBbottom, 1 - (GetCurFrame(paddleBbottom)), 0.5);
  382.     
  383.     if (bottomHoleB == open)
  384.     {
  385.         Print("bottom paddle B is closed");
  386.         Print("top paddle B is open");
  387.         
  388.         bottomHoleB = closed;
  389.         topHoleB = open;
  390.     }
  391.     else
  392.     {
  393.         Print("bottom paddle B is open");
  394.         Print("top paddle B is closed");
  395.     
  396.         bottomHoleB = open;
  397.         topHoleB = closed;
  398.     }
  399.     call paddlecheck;
  400.     
  401.     Sleep(4.0);
  402.  
  403.     SetCameraFocus(2, camera0);
  404.     SetCameraSecondaryFocus(2, h2o);
  405.     SetCurrentCamera(2);
  406.     SetCameraFOV(90, 1, 5.0);
  407.     Sleep(5.0);
  408.  
  409.     # ...return camera to player...
  410.     SetCurrentCamera(1);
  411.     ClearActorFlags(player, 0x200000);
  412.     EndCutscene();
  413.     MoveToFrame(camera1, 0, 10.0);
  414.     MoveToFrame(paddletarget, 0, 10.0);
  415.     
  416.     return;
  417. }
  418.  
  419. return;
  420.  
  421. # ........................................................................................
  422. arrived:
  423. # If "water moving button" is pressed all the way in, return it to out position and call 
  424. # "lightning cog. 
  425. if ((GetSenderRef() == switchA) && (GetCurFrame(switchA) == 1))
  426.     {
  427.     Sleep(0.5);
  428.     MoveToFrame(switchA, 0, 1.0);
  429.     }
  430.  
  431. # If "water stoping button" is pressed all the way in, return it to out position and call 
  432. # "lightning cog. 
  433. if ((GetSenderRef() == switchB) && (GetCurFrame(switchB) == 1))
  434.     {
  435.     Sleep(0.5);
  436.     MoveToFrame(switchB, 0, 1.0);   
  437.     }
  438.  
  439. # If water surface 3do reaches top...
  440. if ((GetSenderRef() == h2o) && (GetCurFrame(h2o) == 0))
  441. {
  442.     Print("water stopped moving at top");
  443.     
  444.     SendMessage(lightningcog, user1);
  445.     Print("sending user1");
  446.     
  447.     #animate electroSurfaces
  448.     Print("starting electrodes because water 3do arrived at top");
  449.     if (GetSurfaceAnim(electroSurf0) == -1)
  450.     {
  451.         electrac0 = SurfaceAnim(electroSurf0, 5, 0x1);
  452.         electrac1 = SurfaceAnim(electroSurf1, 5, 0x1);
  453.         electrac2 = SurfaceAnim(electroSurf2, 5, 0x1);
  454.         electrac3 = SurfaceAnim(electroSurf3, 5, 0x1);
  455.         electrac4 = SurfaceAnim(electroSurf4, 5, 0x1);
  456.         electrac5 = SurfaceAnim(electroSurf5, 5, 0x1);
  457.         electrac6 = SurfaceAnim(electroSurf6, 5, 0x1);
  458.         electrac7 = SurfaceAnim(electroSurf7, 5, 0x1);
  459.     }
  460.     
  461.     # ...turn off water 3do...
  462.     SetThingFlags(h2o, 0x80000);
  463.     
  464.     # ...turn on top water level adjoins...    
  465.     SetFaceGeoMode(surface0a, 4);
  466.     SetFaceGeoMode(surface0b, 4);
  467.     SetFaceGeoMode(surface0c, 4);
  468.     SetFaceGeoMode(surface0d, 4);
  469.     SetFaceGeoMode(surface0e, 4);
  470.     SetFaceGeoMode(surface0f, 4);
  471.     SetFaceGeoMode(surface0g, 4);
  472.     SetFaceGeoMode(surface0h, 4);
  473.     SetFaceGeoMode(surface0i, 4);
  474.     
  475.     # ...turn on top water level sectors...
  476.     SetSectorFlags(twater0, 0x2);
  477.     SetSectorFlags(twater1, 0x2);
  478.     SetSectorFlags(twater2, 0x2);
  479.     SetSectorFlags(twater3, 0x2);
  480.     SetSectorFlags(twater4, 0x2);
  481.     SetSectorFlags(twater5, 0x2);
  482.     SetSectorFlags(twater6, 0x2);
  483.     SetSectorFlags(twater7, 0x2);
  484.     
  485. }
  486.  
  487. # If water 3do reaches middle level...
  488. if ((GetSenderRef() == h2o) && (GetCurFrame(h2o) == 1) && (solved == 1))
  489.     {
  490.     solved=0;
  491.     Print("water stopped moving at middle");
  492.     
  493.     # ...turn off water 3do...
  494.     SetThingFlags(h2o, 0x80000);
  495.     
  496.     # ...turn on the middle water level adjoins.
  497.     SetFaceGeoMode(surface1a, 4);
  498.     SetFaceGeoMode(surface1b, 4);
  499.     SetFaceGeoMode(surface1c, 4);
  500.     SetFaceGeoMode(surface1d, 4);
  501.     SetFaceGeoMode(surface1e, 4);
  502.     SetFaceGeoMode(surface1f, 4);
  503.     SetFaceGeoMode(surface1g, 4);
  504.     SetFaceGeoMode(surface1h, 4);
  505.     
  506.     }
  507.  
  508. # If water 3do reaches bottom...
  509. if ((GetSenderRef() == h2o) && (GetCurFrame(h2o) == 2))
  510. {
  511.     Print("water stopped moving at bottom");
  512.     
  513.     # ...turns off water 3do...
  514.     #SetThingFlags(h2o, 0x80000);
  515.     
  516. }
  517. return;
  518.  
  519. # ........................................................................................
  520. entered:
  521. # If pool is full and player enters the pool, then kill the player.
  522. if (full != 1)    return;
  523. if (GetSourceRef() != player) return;
  524.  
  525. if (GetSenderID() == 1)
  526.     {
  527.     DamageThing(player, 1000, 0x02, 0);
  528.     toggle=1;
  529.     }
  530.     
  531. # If player approaches the pool for the first time.
  532. if ((GetSenderRef() == trigger) && (firstEnter == 0))
  533. {
  534.     firstEnter=1;
  535.     lightning=1;
  536.     Print("lightning on");
  537.     SetTimer(Rand() * 2.5);
  538.     
  539.     Print("starting electrodes because player showed up");
  540.     if (GetSurfaceAnim(electroSurf0) == -1)
  541.     {
  542.         electrac0 = SurfaceAnim(electroSurf0, 5, 0x1);
  543.         electrac1 = SurfaceAnim(electroSurf1, 5, 0x1);
  544.         electrac2 = SurfaceAnim(electroSurf2, 5, 0x1);
  545.         electrac3 = SurfaceAnim(electroSurf3, 5, 0x1);
  546.         electrac4 = SurfaceAnim(electroSurf4, 5, 0x1);
  547.         electrac5 = SurfaceAnim(electroSurf5, 5, 0x1);
  548.         electrac6 = SurfaceAnim(electroSurf6, 5, 0x1);
  549.         electrac7 = SurfaceAnim(electroSurf7, 5, 0x1);
  550.     }
  551. }
  552.  
  553. return;
  554. # ........................................................................................
  555. timer:
  556.  
  557. # Lightning code.
  558. if (toggle == 0)
  559.     {
  560.     for (cnt = 2; cnt <= RandBetween(2, 5); cnt = cnt + 1)
  561.         {
  562.         originIndex = RandBetween(0, 3);
  563.         if (originIndex == 0)
  564.         {
  565.             target = targetArray00[RandBetween(0, 2)];
  566.         }
  567.         else if (originIndex == 1)
  568.         {
  569.             target = targetArray10[RandBetween(0, 2)];
  570.         }
  571.         else if (originIndex == 2)
  572.         {
  573.             target = targetArray20[RandBetween(0, 2)];
  574.         }
  575.         else if (originIndex == 3)
  576.         {
  577.             target = targetArray30[RandBetween(0, 2)];
  578.         }
  579.             
  580.    
  581.         CreatePolylineThing(origin0[originIndex], target, '0 0 0', lightningmat0[RandBetween(0, 4)], 0.1, 0.1, 0.05);
  582.         randnum = RandBetween(0, 3);
  583.         PlaySoundThing(strike0[randnum], target, 0.2, 5, 10, 0);            #was target0
  584.         Sleep(0.05);
  585.         }
  586.     }
  587. if (toggle == 1)
  588.     {
  589.         currentSector=GetThingSector(GetLocalPlayerThing());
  590.     
  591.         if (currentSector == twater0)
  592.         {
  593.             originIndex=0;
  594.             target = targetArray00[RandBetween(0, 2)];
  595.         }
  596.         else if (currentSector == twater1)
  597.  
  598.         {
  599.             originIndex=1;
  600.             target = targetArray10[RandBetween(0, 2)];
  601.         }
  602.         else if (currentSector == twater2)
  603.  
  604.         {
  605.             originIndex=2;
  606.             target = targetArray20[RandBetween(0, 2)];
  607.         }
  608.         else if (currentSector == twater3)
  609.  
  610.         {
  611.             originIndex=3;
  612.             target = targetArray30[RandBetween(0, 2)];
  613.         }
  614.    
  615.     
  616.         CreatePolylineThing(origin0[originIndex], player, '0 0 0', lightningmat0[RandBetween(0, 4)], 0.1, 0.1, 0.15);
  617.         CreatePolylineThing(player, target, '0 0 0', lightningmat0[RandBetween(0, 4)], 0.1, 0.1, 0.15);
  618.         randnum = RandBetween(0, 3);
  619.         PlaySoundThing(strike0[randnum], target, 0.2, 5, 10, 0);            #was target0
  620.     }
  621. if (lightning == 1)
  622. {
  623.     SetTimer(Rand() * 2.5);
  624. }
  625. return;
  626.  
  627. # ........................................................................................
  628. paddlecheck:
  629.  
  630. DebugLocalSymbols("paddlecheck");
  631.  
  632. if ((bottomHoleA == open) && (bottomHoleB == open))
  633. {
  634.     Print("water at bottom and lightning off");
  635.     
  636.     # ...turn off top water surface adjoins...
  637.     SetFaceGeoMode(surface0a, 0);
  638.     SetFaceGeoMode(surface0b, 0);
  639.     SetFaceGeoMode(surface0c, 0);
  640.     SetFaceGeoMode(surface0d, 0);
  641.     SetFaceGeoMode(surface0e, 0);
  642.     SetFaceGeoMode(surface0f, 0);
  643.     SetFaceGeoMode(surface0g, 0);
  644.     SetFaceGeoMode(surface0h, 0);
  645.     SetFaceGeoMode(surface0i, 0);
  646.     
  647.     # Turn off middle level water surface adjoins.
  648.     SetFaceGeoMode(surface1a, 0);
  649.     SetFaceGeoMode(surface1b, 0);
  650.     SetFaceGeoMode(surface1c, 0);
  651.     SetFaceGeoMode(surface1d, 0);
  652.     SetFaceGeoMode(surface1e, 0);
  653.     SetFaceGeoMode(surface1f, 0);
  654.     SetFaceGeoMode(surface1g, 0);
  655.     SetFaceGeoMode(surface1h, 0);
  656.  
  657.     # ...turn off top water sectors...
  658.     ClearSectorFlags(twater0, 0x2);
  659.     ClearSectorFlags(twater1, 0x2);
  660.     ClearSectorFlags(twater2, 0x2);
  661.     ClearSectorFlags(twater3, 0x2);
  662.     ClearSectorFlags(twater4, 0x2);
  663.     ClearSectorFlags(twater5, 0x2);
  664.     ClearSectorFlags(twater6, 0x2);
  665.     ClearSectorFlags(twater7, 0x2);
  666.  
  667.     # ...turn off top water light...
  668.     SetSectorLight(twater0, nolight, 2);
  669.     SetSectorLight(twater1, nolight, 2);
  670.     SetSectorLight(twater2, nolight, 2);
  671.     SetSectorLight(twater3, nolight, 2);
  672.     SetSectorLight(twater4, nolight, 2);
  673.     SetSectorLight(twater5, nolight, 2);
  674.     SetSectorLight(twater6, nolight, 2);
  675.     SetSectorLight(twater7, nolight, 2);
  676.     
  677.     # ...turn off bottom water sectors...
  678.     ClearSectorFlags(bwater0, 0x2);
  679.     ClearSectorFlags(bwater1, 0x2);
  680.     ClearSectorFlags(bwater2, 0x2);
  681.     ClearSectorFlags(bwater3, 0x2);
  682.     #ClearSectorFlags(bwater4, 0x2);
  683.     
  684.     # ...turn off bottom light...
  685.     SetSectorLight(bwater0, nolight, 2);
  686.     SetSectorLight(bwater1, nolight, 2);
  687.     SetSectorLight(bwater2, nolight, 2);
  688.     SetSectorLight(bwater3, nolight, 2);
  689.     #SetSectorLight(bwater4, nolight, 2);
  690.     
  691.     # ...turn off top paddle sector lights...
  692.     SetSectorLight(ptsec0, nolight, 2);
  693.     SetSectorLight(ptsec1, nolight, 2);
  694.     SetSectorLight(ptsec2, nolight, 2);
  695.  
  696.     # ...turn off bottom paddle sector lights...
  697.     SetSectorLight(pbsec0, nolight, 2);
  698.     SetSectorLight(pbsec1, nolight, 2);
  699.     SetSectorLight(pbsec2, nolight, 2);
  700.     
  701.     #stop animating electrosurfaces
  702.     Print("stop electrodes because both bottom paddles open");
  703.     
  704.     StopAnim(elecTrac0);
  705.     StopAnim(elecTrac1);
  706.     StopAnim(elecTrac2);
  707.     StopAnim(elecTrac3);
  708.     StopAnim(elecTrac4);
  709.     StopAnim(elecTrac5);
  710.     StopAnim(elecTrac6);
  711.     StopAnim(elecTrac7);
  712.         
  713.     # ...turn off water 3do...
  714.     #ClearThingFlags(h2o, 0x80000);
  715.     
  716.     SendMessage(lightningcog, user0);
  717.     Print("sending user0");
  718.     
  719.     #moves water to bottom position
  720.     ClearThingFlags(h2o, 0x80000);
  721.     MoveToFrame(h2o, 2, countdown);
  722.     full = 0;
  723.     lightning=0;
  724.     SetTimer(0.0);
  725.     return;
  726. }
  727.  
  728. if ((topHoleA == open) && (topHoleB == open))
  729. {
  730.     Print("water at middle and lightning off");
  731.     Print("The water has stoped in the middle!");
  732.     solved=1;
  733.     
  734.     # ...turn off top water surface adjoins...
  735.     SetFaceGeoMode(surface0a, 0);
  736.     SetFaceGeoMode(surface0b, 0);
  737.     SetFaceGeoMode(surface0c, 0);
  738.     SetFaceGeoMode(surface0d, 0);
  739.     SetFaceGeoMode(surface0e, 0);
  740.     SetFaceGeoMode(surface0f, 0);
  741.     SetFaceGeoMode(surface0g, 0);
  742.     SetFaceGeoMode(surface0h, 0);
  743.     SetFaceGeoMode(surface0i, 0);
  744.     
  745.     # ... middle water surface adjoins turned on when h2o 3do arrives
  746.  
  747.     # ...turn bottom water sectors on...
  748.     SetSectorFlags(bwater0, 0x2);
  749.     SetSectorFlags(bwater1, 0x2);
  750.     SetSectorFlags(bwater2, 0x2);
  751.     SetSectorFlags(bwater3, 0x2);
  752.     #SetSectorFlags(bwater4, 0x2);
  753.     
  754.     # ...make bottom water light...
  755.     SetSectorLight(bwater0, veclight, 2);
  756.     SetSectorLight(bwater1, veclight, 2);
  757.     SetSectorLight(bwater2, veclight, 2);
  758.     SetSectorLight(bwater3, veclight, 2);
  759.     #SetSectorLight(bwater4, veclight, 2);
  760.     
  761.     # ...make bottom paddle sector lights...
  762.     SetSectorLight(pbsec0, veclight, 2);
  763.     SetSectorLight(pbsec0, veclight, 2);
  764.     SetSectorLight(pbsec0, lesslight, 2);
  765.  
  766.     # ...turn off top water sectors...
  767.     ClearSectorFlags(twater0, 0x2);
  768.     ClearSectorFlags(twater1, 0x2);
  769.     ClearSectorFlags(twater2, 0x2);
  770.     ClearSectorFlags(twater3, 0x2);
  771.     ClearSectorFlags(twater4, 0x2);
  772.     ClearSectorFlags(twater5, 0x2);
  773.     ClearSectorFlags(twater6, 0x2);
  774.     ClearSectorFlags(twater7, 0x2);
  775.  
  776.     # ...turn off top water light...
  777.     SetSectorLight(twater0, nolight, 2);
  778.     SetSectorLight(twater1, nolight, 2);
  779.     SetSectorLight(twater2, nolight, 2);
  780.     SetSectorLight(twater3, nolight, 2);
  781.     SetSectorLight(twater4, nolight, 2);
  782.     SetSectorLight(twater5, nolight, 2);
  783.     SetSectorLight(twater6, nolight, 2);
  784.     SetSectorLight(twater7, nolight, 2);
  785.  
  786.     # ...turn off top paddle sector lights...
  787.     SetSectorLight(ptsec0, nolight, 2);
  788.     SetSectorLight(ptsec1, nolight, 2);
  789.     SetSectorLight(ptsec2, nolight, 2);
  790.     
  791.     # ...turn on water 3do and move it to center position...
  792.     ClearThingFlags(h2o, 0x80000);
  793.     MoveToFrame(h2o, 1, countdown);
  794.     
  795.     lightning=0;
  796.     SetTimer(0.0);
  797.     full = 0;
  798.     
  799.     Sleep(1.0);
  800.     
  801.     SendMessage(lightningcog, user0);
  802.     Print("sending user0");
  803.     
  804.     Print("stopping electrodes because both middle holes are open");
  805.     #stop animating electrosurfaces
  806.     StopAnim(elecTrac0);
  807.     StopAnim(elecTrac1);
  808.     StopAnim(elecTrac2);
  809.     StopAnim(elecTrac3);
  810.     StopAnim(elecTrac4);
  811.     StopAnim(elecTrac5);
  812.     StopAnim(elecTrac6);
  813.     StopAnim(elecTrac7);
  814.     return;
  815. }
  816. else
  817. {
  818.     Print("put water at top and turn on lightning.");
  819.     
  820.     # Turn off middle level water adjoins.
  821.     SetFaceGeoMode(surface1a, 0);
  822.     SetFaceGeoMode(surface1b, 0);
  823.     SetFaceGeoMode(surface1c, 0);
  824.     SetFaceGeoMode(surface1d, 0);
  825.     SetFaceGeoMode(surface1e, 0);
  826.     SetFaceGeoMode(surface1f, 0);
  827.     SetFaceGeoMode(surface1g, 0);
  828.     SetFaceGeoMode(surface1h, 0);
  829.     
  830.     # ...turn bottom water sectors on...
  831.     SetSectorFlags(bwater0, 0x2);
  832.     SetSectorFlags(bwater1, 0x2);
  833.     SetSectorFlags(bwater2, 0x2);
  834.     SetSectorFlags(bwater3, 0x2);
  835.     #SetSectorFlags(bwater4, 0x2);
  836.     
  837.  
  838.     # ...make bottom water light...
  839.     SetSectorLight(bwater0, veclight, 2);
  840.     SetSectorLight(bwater1, veclight, 2);
  841.     SetSectorLight(bwater2, veclight, 2);
  842.     SetSectorLight(bwater3, veclight, 2);
  843.     #SetSectorLight(bwater4, veclight, 2);
  844.     
  845.     # ...make bottom paddle sectors light...
  846.     SetSectorlight(pbsec0, veclight, 2);
  847.     SetSectorlight(pbsec1, veclight, 2);
  848.     SetSectorlight(pbsec2, lesslight, 2);
  849.     
  850.     # ...turn top water sectors on...
  851.     SetSectorFlags(twater0, 0x2);
  852.     SetSectorFlags(twater1, 0x2);
  853.     SetSectorFlags(twater2, 0x2);
  854.     SetSectorFlags(twater3, 0x2);
  855.     SetSectorFlags(twater4, 0x2);
  856.     SetSectorFlags(twater5, 0x2);
  857.     SetSectorFlags(twater6, 0x2);
  858.     SetSectorFlags(twater7, 0x2);
  859.  
  860.     # ...make top water light...
  861.     SetSectorLight(twater0, veclight, 2);
  862.     SetSectorLight(twater1, veclight, 2);
  863.     SetSectorLight(twater2, veclight, 2);
  864.     SetSectorLight(twater3, veclight, 2);
  865.     SetSectorLight(twater4, veclight, 2);
  866.     SetSectorLight(twater5, veclight, 2);
  867.     SetSectorLight(twater6, veclight, 2);
  868.     SetSectorLight(twater7, veclight, 2);
  869.  
  870.     # ...make top paddle sectors light...
  871.     SetSectorlight(ptsec0, veclight, 2);
  872.     SetSectorlight(ptsec1, veclight, 2);
  873.     SetSectorlight(ptsec2, lesslight, 2);
  874.  
  875.     # ...turn on water 3do and move it to top position...
  876.     ClearThingFlags(h2o, 0x80000);
  877.     MoveToFrame(h2o, 0, countdown);
  878.     
  879.     full = 1;
  880.     lightning=1;
  881.     SetTimer(Rand() * 2.5);
  882. }
  883. return;
  884. # ........................................................................................
  885. end
  886.